#@layout()

#define script()
<script>
function removePlugin(){
	$("#progressbar").addClass("active");
	$("#remove").unbind("click");
	$("#remove").attr("disabled", "disabled");
	$.post("/admin/addon/trace/removePlugin",
		null,
		function(data){
			$("#apply").click(applyPlugin);
			$("#apply").removeAttr("disabled");
			$("#notice").text("移除操作成功了，你可以再次将插件应用到当前主题");
			$("#progressbar").removeClass("active");
		},
		"json"
	);
}

function applyPlugin(){
	$("#progressbar").addClass("active");
	$("#apply").unbind("click");
	$("#apply").attr("disabled", "disabled");
	$.post("/admin/addon/trace/applyPlugin",
		null,
		function(data){
			$("#remove").click(removePlugin);
			$("#remove").removeAttr("disabled");
			$("#notice").text("应用操作成功了，你可以再次从当前主题中移除本插件");
			$("#progressbar").removeClass("active");
		},
		"json"
	);
}

$(function(){
	$.post("/admin/addon/trace/checkPlugin", 
		null,
		function(data){
			if(data && data.code){
				$("#apply").attr("disabled",'disabled');
				$("#notice").text("你可以从当前主题中移除本插件");
				$("#remove").click(removePlugin);
			}else{
				$("#remove").attr("disabled",'disabled');
				$("#notice").text("你可以将插件应用到当前主题");
				$("#apply").click(applyPlugin);
			}
		},
		"json");
});
</script>
#end

#define content()
<div class="content-wrapper">

    <section class="content-header">
        <h1>追忆插件设置  <small>Trace Plugin Setting</small></h1>
    </section>

    <section class="content">

        <div class="row">
            <div class="col-xs-12">
	            <div class="panel panel-default">
				    <div class="panel-body">
				        <button type="button" id="apply" class="btn btn-primary">将插件页面应用到当前主题</button>
				        &nbsp;&nbsp;&nbsp;&nbsp;
	                	<button type="button" id="remove" class="btn btn-primary">从当前主题移除本插件</button>
	                	<br><br>
	                	<div id="progressbar" class="progress progress-striped">
							<div class="progress-bar progress-bar-success" role="progressbar"
								 aria-valuenow="60" aria-valuemin="0" aria-valuemax="100"
								 style="width: 100%;">
								<span class="sr-only">100% 完成</span>
							</div>
						</div>
				    </div>
				    <div id="notice" class="panel-footer"></div>
	            </div>
            </div>
        </div>
        <div class="row">
        	<div class="col-xs-12">
                <div class="panel panel-default">
				    <div class="panel-body">
				      	  作者：almond，如有疑问，请联系：QQ2589071709
				    </div>
				</div>
            </div>
        </div>

    </section>

</div>
#end
